//
//  HomeDatePage.m
//  Pictorial
//
//  Created by SKY on 15/12/28.
//  Copyright © 2015年 sky. All rights reserved.
//

#import "HomeDatePage.h"
#import "WallpaperDownloadView.h"
#import <UIImageView+WebCache.h>
@interface HomeDatePage ()

@property (weak, nonatomic) IBOutlet UIImageView *picture;
@property (weak, nonatomic) IBOutlet UILabel *dayLabel;
@property (weak, nonatomic) IBOutlet UILabel *monthLabel;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *descLabel;

@end
@implementation HomeDatePage

-(void)willMoveToSuperview:(UIView *)newSuperview{
    self.picture.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(downLoad)];
    [self.picture addGestureRecognizer:tap];
}
-(void)downLoad{

    WallpaperDownloadView *downloadView = [WallpaperDownloadView nibInitializtion];
    [self addSubview:downloadView];
    
    downloadView.pictureString = self.model.ios_wallpaper_url;
    downloadView.title = self.model.title;
    downloadView.desc = self.model.destination;
}
-(void)setModel:(HomeDateModel *)model{
    _model = model;
    
    [self.picture imageLoadProgressWithNetImage:model.ios_wallpaper_url];
    self.titleLabel.text = model.title;
    self.descLabel.text = model.destination;
}
-(void)setPage:(int)page{
    _page = page;
    
    self.dayLabel.text = [[NSDate dateFromDay:page] day];
    self.monthLabel.text = [[NSDate dateFromDay:page] month];
}
- (IBAction)more:(id)sender {
    [_delegate more];
}

@end
